package com.agileboot.domain.system.danger.query;

import cn.hutool.core.util.StrUtil;

import com.agileboot.common.core.page.AbstractPageQuery;
import com.agileboot.domain.system.danger.db.DangerSourceEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class DangerSourceQuery extends AbstractPageQuery<DangerSourceEntity> {

    private String dangerSourceName;
    private String dangerType;
    private String actionMakerName; // 新增措施制定人查询条件

    @Override
    public QueryWrapper<DangerSourceEntity> addQueryCondition() {
        QueryWrapper<DangerSourceEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.like(StrUtil.isNotEmpty(dangerSourceName), "danger_source_name", dangerSourceName)
                .eq(StrUtil.isNotEmpty(dangerType), "danger_type", dangerType)
                .like(StrUtil.isNotEmpty(actionMakerName), "action_maker_name", actionMakerName); // 添加措施制定人查询条件
        this.setTimeRangeColumn("create_time");
        return queryWrapper;
    }
}
